//
//  ZTextField.m
//
//  Created by ZhàoYǒng on 31/10/2017.
//  Copyright © 2017 ZhàoYǒng. All rights reserved.
//

#import "ZTextField.h"

@implementation ZTextField

//控制文本所在的的位置，左右缩
- (CGRect)textRectForBounds:(CGRect)bounds {
    
    CGRect rect = [super textRectForBounds:bounds];

    UIEdgeInsets insets = UIEdgeInsetsMake(0, _paddingLeft, 0, _paddingRight);

    return UIEdgeInsetsInsetRect(rect, insets);
    
}

//控制编辑文本时所在的位置，左右缩
- (CGRect)editingRectForBounds:(CGRect)bounds {
    
    CGRect rect = [super editingRectForBounds:bounds];

    UIEdgeInsets insets = UIEdgeInsetsMake(0, _paddingLeft, 0, _paddingRight);

    return UIEdgeInsetsInsetRect(rect, insets);

}

@end
